﻿
    using Chain.BLL;
    using System;
    using System.Data;
    using System.Text;
    using System.Text.RegularExpressions;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;

    public partial class historyexpenseByStores : Page
    {
   
        private OrderDetail OrderDetailBll = new OrderDetail();
        private OrderLog OrderLogBll = new OrderLog();
  

        protected string GetOrderDetail(object objOrderType, object objOrderID, object objOrderMemID)
        {
            StringBuilder sbStr = new StringBuilder();
            if (objOrderType.ToString() != "0")
            {
                if (objOrderType.ToString() == "1")
                {
                    int MemID = Convert.ToInt32(objOrderMemID);
                    int OrderID = Convert.ToInt32(objOrderID);
                    string ProjectName = this.OrderDetailBll.ProjectName(MemID, OrderID);
                    sbStr.AppendFormat("<span>计时项目名称<span style=\"color:red;margin-left:10px;\">{0}</span></span>", ProjectName);
                    sbStr.Append("<hr color=\"#CCCCCC\" size=\"1\"/>");
                }
                else if (objOrderType.ToString() == "2")
                {
                    sbStr.AppendFormat("<a href=\"#{0}\" data-load=\"{0}.aspx?OrderID={1}&type=lookinventory&OrderType={2}\"  data-role=\"button\" data-inline=\"true\" data-mini=\"true\">详情</a>", "historyexpenseByStoresDetail", objOrderID, objOrderType);
                }
                else if (objOrderType.ToString() == "7")
                {
                    sbStr.AppendFormat("<a href=\"#{0}\" data-load=\"{0}.aspx?OrderID={1}&type=lookinventory&OrderType={2}\"  data-role=\"button\" data-inline=\"true\" data-mini=\"true\">详情</a>", "historyexpenseByStoresDetail", objOrderID, objOrderType);
                }
            }
            return sbStr.ToString();
        }

        protected string GetOrderType(int intOrderType)
        {
            string strOrderType = "";
            switch (intOrderType)
            {
                case 0:
                    return "快速消费";

                case 1:
                    return "计时消费";

                case 2:
                    return "商品消费";

                case 3:
                case 5:
                    return strOrderType;

                case 4:
                    return "消费撤单";

                case 6:
                    return "消费退货";

                case 7:
                    return "计次消费";
            }
            return strOrderType;
        }

        protected string GetPayStr(object objOrderPayCard, object objOrderPayCash, object objOrderPayBink, object objOrderPayCoupon)
        {
            StringBuilder sbStr = new StringBuilder();
            decimal OrderPayCard = Convert.ToInt32(objOrderPayCard);
            if (OrderPayCard > 0M)
            {
                sbStr.AppendFormat("<span>余额支付<span style=\"color:red;margin-left:10px;\">{0}</span></span>", OrderPayCard.ToString("0.00"));
                sbStr.Append("<hr color=\"#CCCCCC\" size=\"1\"/>");
            }
            decimal OrderPayCash = Convert.ToInt32(objOrderPayCash);
            if (OrderPayCash > 0M)
            {
                sbStr.AppendFormat("<span>现金支付<span style=\"color:red;margin-left:10px;\">{0}</span></span>", OrderPayCash.ToString("0.00"));
                sbStr.Append("<hr color=\"#CCCCCC\" size=\"1\"/>");
            }
            decimal OrderPayBink = Convert.ToInt32(objOrderPayBink);
            if (OrderPayBink > 0M)
            {
                sbStr.AppendFormat("<span>银联支付<span style=\"color:red;margin-left:10px;\">{0}</span></span>", OrderPayBink.ToString("0.00"));
                sbStr.Append("<hr color=\"#CCCCCC\" size=\"1\"/>");
            }
            decimal OrderPayCoupon = Convert.ToInt32(objOrderPayCoupon);
            if (OrderPayCoupon > 0M)
            {
                sbStr.AppendFormat("<span>优惠券支付<span style=\"color:red;margin-left:10px;\">{0}</span></span>", OrderPayCoupon.ToString("0.00"));
                sbStr.Append("<hr color=\"#CCCCCC\" size=\"1\"/>");
            }
            return sbStr.ToString();
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if ((base.Request.Cookies["uid"] != null) && Regex.IsMatch(base.Request.Cookies["uid"].Value, @"^\d+$"))
            {
                int MemID = Convert.ToInt32(base.Request.Cookies["uid"].Value);
                DataTable dt = this.OrderLogBll.GetList("OrderMemID=" + MemID + " and OrderType in (0,1,2,7) order by OrderID desc").Tables[0];
                this.rpthistoryexpenseByStoresDetail.DataSource = dt;
                this.rpthistoryexpenseByStoresDetail.DataBind();
                if (dt.Rows.Count == 0)
                {
                    this.msg.Style.Add("display", "");
                }
            }
        }
    }


